home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 009a / eqpt.zip / EQPT.C next >
Text File  |  1993-05-22  |  1KB  |  64 lines

  1.  
  2. /* System equipment determination utility */
  3. /* From DOS Programmer's Reference 2nd Edition*/
  4. /* by Terry Dettmann*/
  5. #include<stdio.h>
  6.  
  7. #define    BOOL    int
  8. #define    FALSE    0
  9. #define TRUE    !FALSE
  10.  
  11. main()
  12.  
  13. {
  14.     int    eqpt;
  15.     eqpt = equipment(TRUE);
  16.     printf("Equipment value is %x\n",eqpt);
  17.     }
  18. #include<dos.h>
  19.  
  20. #define    EQUIPMENT 0x11
  21.  
  22. equipment(print)
  23.  
  24. BOOL    print;
  25.  
  26. {
  27.     union    REGS    regs;
  28.     int    eqpt;
  29.  
  30.     int86(EQUIPMENT,®s,®s);
  31.     if(print){
  32.         eqpt = regs.x.ax;
  33.         if(eqpt & 0x01)
  34.             printf("Floppy drives are attached\n");
  35.         if(eqpt>>1 & 0x01)
  36.             printf("Math coprocessor installed\n");
  37.         switch(eqpt>>4 & 0x03){
  38.             case 1:
  39.                 printf("Initial video mode 40x25 color\n");
  40.                 break;
  41.             case 2:
  42.                 printf("Initial video mode 80x25 color\n");
  43.                 break;
  44.             case 3:
  45.                 printf("Initial video mode 80x25 mono\n");
  46.                 break;
  47.         }
  48.         if(eqpt>>6 & 0x01)
  49.             printf("Number of disk drives is %d\n",
  50.                 (eqpt>>6 & 0x03) + 1);
  51.         printf("Number of RS-232 ports is %d\n",
  52.             eqpt>>9 & 0x07);
  53.         if(eqpt>>12 & 0x01)
  54.             printf("Game adapter installed\n");
  55.         if(eqpt>>13 & 0x01)
  56.             printf("Internal modem installed\n");
  57.         printf("Number of printers is %d\n",
  58.                 eqpt>>14 & 0x03);
  59.  
  60.     }
  61.     return(regs.x.ax);
  62. }
  63.  
  64.